import request from '@/utils/request'

// 查询学习小组列表
export function listGroup(query) {
  return request({
    url: '/exam/group/list',
    method: 'get',
    params: query
  })
}

// 查询学习小组详细
export function getGroup(id) {
  return request({
    url: '/exam/group/' + id,
    method: 'get'
  })
}

// 新增学习小组
export function addGroup(data) {
  return request({
    url: '/exam/group',
    method: 'post',
    data: data
  })
}

// 修改学习小组
export function updateGroup(data) {
  return request({
    url: '/exam/group',
    method: 'put',
    data: data
  })
}

// 删除学习小组
export function delGroup(id) {
  return request({
    url: '/exam/group/' + id,
    method: 'delete'
  })
}

// 新增学习小组和材料关系
export function insertExamGroupMaterials(data) {
  return request({
    url: '/exam/GroupMaterial/insertExamGroupMaterials',
    method: 'post',
    data: data
  })
}

// 删除学习小组下面的相关材料
export function delGroupMaterials(id) {
  return request({
    url: '/exam/GroupMaterial/' + id,
    method: 'delete'
  })
}

// 查询学习小组下的科目列表
export function selectExamGroupSubjectListByGroupId(groupId, query) {
  return request({
    url: '/exam/groupSubject/selectExamGroupSubjectListByGroupId/' + groupId,
    method: 'get',
    params: query
  })
}

// 查询学习小组下的科目列表
export function selectExamGroupSubjectListByGroupIdNotIn(groupId, query) {
  return request({
    url: '/exam/groupSubject/selectExamGroupSubjectListByGroupIdNotIn/' + groupId,
    method: 'get',
    params: query
  })
}

// 新增学习小组和科目关系
export function insertExamGroupSubjects(data) {
  return request({
    url: '/exam/groupSubject',
    method: 'post',
    data: data
  })
}

// 删除学习小组和科目关系
export function delGroupSubject(id) {
  return request({
    url: '/exam/groupSubject/' + id,
    method: 'delete'
  })
}

// 查询学习小组下的成员列表
export function selectExamGroupMemberList(groupId, query) {
  return request({
    url: '/exam/member/list/' + groupId,
    method: 'get',
    params: query
  })
}

// 查询学习小组下的未添加的成员列表
export function selectExamGroupMemberNotInList(groupId, query) {
  return request({
    url: '/exam/member/selectExamGroupMemberNotInList/' + groupId,
    method: 'get',
    params: query
  })
}
// 批量新增学习小组成员
export function batchAdd(data) {
  return request({
    url: '/exam/member/batchAdd',
    method: 'post',
    data: data
  })
}

// 删除学习小组里面的学习成员
export function delGroupMembers(id) {
  return request({
    url: '/exam/member/' + id,
    method: 'delete'
  })
}
